package com.zygh.lz.task;

import com.zygh.lz.service.SchedulingInfoService;
import com.zygh.lz.service.VehicleCoordinateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @auther shuaiqi
 * 清障车
 */

@Slf4j
@Component
public class RoadRescueTask {

    @Autowired
    private SchedulingInfoService schedulingInfoService;

    @Autowired
    private VehicleCoordinateService vehicleCoordinateService;


    /**
     *每天早上五点定时删除昨天清障车排班的数据
     */
    @Async
    @Scheduled(cron = "0 0 05 * * ? ")
    public void deleteSchedulingInfo() {
        log.info("每天早上五点删除昨天的清障车排班");
        schedulingInfoService.deleteSchedulingInfo();
    }

    /**
     *每天早上五点定时删除昨天车辆定位的数据
     */
    @Async
    @Scheduled(cron = "0 0 05 * * ? ")
    public void deleteVehicleCoordinate() {
        log.info("每天早上五点删除昨天的车辆定位");
        vehicleCoordinateService.deleteVehicleCoordinate();
    }
}
